package objects;

import java.io.IOException;
import objects.visualization.Block;
import objects.visualization.TextBlock;

public class Field extends StaticObject {
	public GruClass type;
	public int index;

	public Field() {
		this.gruClass = fieldClass;
	}
	
	@Override
	public void io() throws IOException {
		iD = stringIO( iD );
		type = objectIO( type );
		isStatic = booleanIO( isStatic );
	}
	
	@Override
	public DataObject newObject() {
		return new Field();
	}

	public String headerCode() {
		return ( isStatic ? "static " :  "" ) + type.iD + " " + iD;
	}

	Block toBlock() {
		return new TextBlock( this, headerCode(), 0 );
	}
}
